package cn.edu.qfnu.oj.service.impl;

import cn.edu.qfnu.common.exception.db.NoRecordFoundException;
import cn.edu.qfnu.common.exception.db.RecordAlreadyExistedException;
import cn.edu.qfnu.common.exception.db.WrongParameterException;
import cn.edu.qfnu.common.service.Impl.BaseServiceImpl;
import cn.edu.qfnu.oj.dao.TeacherDao;
import cn.edu.qfnu.oj.entity.Task;
import cn.edu.qfnu.oj.entity.Teacher;
import cn.edu.qfnu.oj.service.TeacherService;
import org.hibernate.criterion.DetachedCriteria;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDateTime;

/**
 * OnlineJudge of QF_NU
 * Created by LS on 2017/7/17.
 */

@Service("teacherService")
public class TeacherServiceImpl extends BaseServiceImpl<Teacher, String> implements TeacherService {

    @Resource
    private TeacherDao teacherDao;

    @Override
    public void register(Teacher teacher) throws RecordAlreadyExistedException {

    }

    @Override
    public Teacher login(String username, String password)
            throws NoRecordFoundException, WrongParameterException {
        DetachedCriteria detachedCriteria = DetachedCriteria.forClass(Teacher.class);

        return null;
    }

    @Override
    public void createProblem(String title, String content,
                              String inputDesc, String outputDesc, String sampleInput, String sampleOutput,
                              String classify, LocalDateTime createTime, String difficulty, String hint, String sources,
                              Integer memoryLimit, Integer timeLimit, Boolean isAcm, Boolean isTemp) {

    }

    @Override
    public void createTask(String title, String content, LocalDateTime startTime, LocalDateTime endTime, String term) {
        Task task = new Task(title, content, startTime, endTime, term);
        teacherDao.create(task);
    }

    @Override
    public void modifyProblem(Object object) {

    }

    @Override
    public void deleteProblem(Object object) {

    }
}
